package demo4j;

import apijson.Log;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.lang.NonNull;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import unitauto.jar.UnitAutoApp;

/**
 * Hello world!
 */
@SpringBootApplication
public class MyAppEntry3 {
    public static void main(String[] args) {
        SpringApplication.run(MyAppEntry3.class, args);

        Log.DEBUG = true;
        UnitAutoApp.init();
    }

    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(@NonNull CorsRegistry registry) {
                registry.addMapping("/**").allowedOriginPatterns("*").allowedMethods("*").allowCredentials(true).maxAge(3600);
            }
        };
    }
}
